#include "bad_plane1.h"
#include "config.h"
#include <QTime>
#include <random>


bad_plane1::bad_plane1()
{
    plane.load(BAD_ICON);
    plane = plane.scaled(48,48,Qt::KeepAspectRatio);
    m_speed = 2;

    // 创建随机数设备
        std::random_device rd;
        // 结合随机设备和当前时间的毫秒数创建种子序列
        std::seed_seq seed{rd(), static_cast<unsigned int>(QDateTime::currentMSecsSinceEpoch())};
        // 使用种子序列初始化随机数引擎
        std::mt19937 gen(seed);

        // 定义随机数分布，生成 0 到 100 之间的整数
        std::uniform_int_distribution<> dis(10, GAME_WINDOW_WIDE-plane.width()-10);
        int randomInt = dis(gen);

    m_x = randomInt;
    m_y = -plane.height();


    plane_rect.setWidth(plane.width());
    plane_rect.setHeight(plane.height());
    plane_rect.moveTo(m_x,m_y);

    bl_m1_num = randomInt%30;

    life = 1;

}
